package design.Day05;

public class ProxyTest {
    public static void main(String[] args) {
        Proxy proxy = new Proxy(new RealStar());
        proxy.confer();
        proxy.signContract();
        proxy.bookTicker();
        proxy.sing();
        proxy.collectMoney();

        Proxy proxy1 = new Proxy(new SingStar());
        proxy1.confer();
        proxy1.signContract();
        proxy1.bookTicker();
        proxy1.sing();
        proxy1.collectMoney();
    }
}
/**
 * 明星接口
 * @Description TODO 19:52
 * @param
 * @return
*/
interface Star{
    //面谈
    public void confer();
    //签合同
    public void signContract();
    //订票
    public void bookTicker();
    //唱歌
    public void sing();
    //收钱
    public void collectMoney();
}
class SingStar implements Star{

    @Override
    public void confer() {

    }

    @Override
    public void signContract() {

    }

    @Override
    public void bookTicker() {

    }

    @Override
    public void sing() {
        System.out.println("刘德华需要自己唱歌");
    }

    @Override
    public void collectMoney() {

    }
}

class RealStar implements Star{

    @Override
    public void confer() {

    }

    @Override
    public void signContract() {

    }

    @Override
    public void bookTicker() {

    }

    @Override
    public void sing() {
        System.out.println("张学友需要自己唱歌");
    }

    @Override
    public void collectMoney() {

    }
}

class Proxy implements Star{

    private Star star;

    public Proxy(Star star){
        this.star = star;
    }

    @Override
    public void confer() {
        System.out.println("经纪人面谈");
    }

    @Override
    public void signContract() {
        System.out.println("经纪人签合同");
    }

    @Override
    public void bookTicker() {
        System.out.println("经纪人订票");
    }

    @Override
    public void sing() {
        star.sing();
    }

    @Override
    public void collectMoney() {
        System.out.println("经纪人收钱");
    }
}